package com.changgou.order.feign;

import com.changgou.entity.Result;
import com.changgou.order.pojo.CartItem;
import feign.Headers;
import feign.RequestLine;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@FeignClient(name = "order")
@RequestMapping("/cart")
public interface CartFeign {

    /**
     * 添加购物车
     * @param skuId
     * @param num
     * @return
     */
    @PostMapping("/add")
    Response add(@RequestParam("skuId")String skuId, @RequestParam("num")Integer num);
    /**
     * 获取购物车
     * @return
     */
    @GetMapping("/list")
    Result<Map> list();

    @DeleteMapping("/{skuId}")
    Response deleteCart(@PathVariable("skuId") String skuId);

    @PutMapping("/{skuId}/{checked}")
    Response upDate(@PathVariable("skuId") String skuId,@PathVariable("checked")  boolean checked);
}
